package org.hxzon.tapestry5.components;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.annotations.BeginRender;
import org.apache.tapestry5.annotations.Parameter;

public class BackLink {

    @Parameter(name = "css", value = "back", defaultPrefix = BindingConstants.LITERAL)
    private String cssClass;

    @Parameter(value = "返回", defaultPrefix = BindingConstants.LITERAL)
    private String label;

    @Parameter(defaultPrefix = BindingConstants.PROP)
    private String backUrl;

    @BeginRender
    void begin(MarkupWriter writer) {
        writer.element("a", "href", backUrl, "css", cssClass);
        writer.write(label);
        writer.end();
    }

}
